
--[[

    slimui - Copyright (c) 2011 atom0s, All rights reserved.

    See Copyright notice in slimui.lua
    
]]--

class 'CheckBox: ButtonControl' { ... };

----------------------------------------------------------------------------------
-- func: CheckBox.__init__
-- desc: Constructor called when this object is first created.
----------------------------------------------------------------------------------
function CheckBox.__init__( self )
    ButtonControl.__init__( self );
end

----------------------------------------------------------------------------------
-- func: CheckBox:Create
-- desc: Creates a new CheckBox object.
----------------------------------------------------------------------------------
function CheckBox:Create( parent )
    if parent == nil or parent._object == nil then
        slimui:err( 'CheckBox:Create - parent must be set to create a control!' );
    end
    
    self._object = createCheckBox( parent._object );
    
    if self._object == nil then
        slimui:err( 'CheckBox:Create - failed to initialize a new object.' );
    end
    
    return self;
end

----------------------------------------------------------------------------------
-- func: CheckBox:GetAllowGrayed
-- desc: Returns the allow grayed property of this object.
----------------------------------------------------------------------------------
function CheckBox:GetAllowGrayed( )
    return checkbox_getAllowGrayed( self._object );
end

----------------------------------------------------------------------------------
-- func: CheckBox:SetAllowGrayed
-- desc: Sets the allow grayed property of this object.
----------------------------------------------------------------------------------
function CheckBox:SetAllowGrayed( allow )
    checkbox_setAllowGrayed( self._object, allow );
end

----------------------------------------------------------------------------------
-- func: CheckBox:GetState
-- desc: Returns the state of this object.
----------------------------------------------------------------------------------
function CheckBox:GetState( )
    return checkbox_getState( self._object );
end

----------------------------------------------------------------------------------
-- func: CheckBox:SetState
-- desc: Sets the state of this object.
----------------------------------------------------------------------------------
function CheckBox:SetState( state )
    checkbox_setState( self._object, state );
end

----------------------------------------------------------------------------------
-- func: CheckBox:OnChange
-- desc: Sets the OnChange event handler of this object.
----------------------------------------------------------------------------------
function CheckBox:OnChange( func )
    checkbox_onChange( self._object, func );
end



--[[ Debug information. ]]--------------------------------------------------------
if ( slimui:isdebug() == true ) then
    slimui:msg( '(Control) checkbox.lua successfully loaded.' );
end